/**********************************************************************************
 * Copyright (c) 2012 - 2012,  parallel, All right reserved
 * Title: com.adc.parallel.dto  BaseTaskDto.java 
 * @author shen  shenqiao2012@163.com 
 *  2012-11-21 上午11:07:54 
 *********************************************************************************/


package com.adc.parallel.dto;


import com.adc.parallel.constants.SysConstants;


/**
 * 
 * Description: base task dto which contains task all data,
 * and this dto is the unique for the aimed task
 * @author shen  shenqiao2012@163.com 
 * @param <T>
 */
public abstract class BaseTaskDto<T> {
	private String gid;
	private String uuid;
	private T taskData;
	
	/** 
	 *     
	 */
	public BaseTaskDto(String uuid,T taskData) {
		// TODO Auto-generated constructor stub
		this.gid=SysConstants.getGid();
		this.uuid=uuid;
		this.taskData=taskData;
	}
	
	/**
	 * Description:  
	 * @see java.lang.Object#toString() 
	 */
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return SysConstants.getPersistentFormat(gid, uuid, taskDataToString());
	}
	
	/**
	 * 
	 * Description: exchange taskData to string ,convenient to persistent; 
	 * author:  shen
	 * @return String
	 */
	public abstract String taskDataToString();
	
	/**
	 * @return the gid
	 */
	public String getGid() {
		return gid;
	}
	/**
	 * @param gid the gid to set
	 */
	public void setGid(String gid) {
		this.gid = gid;
	}
	/**
	 * @return the uuid
	 */
	public String getUuid() {
		return uuid;
	}
	/**
	 * @param uuid the uuid to set
	 */
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}
	/**
	 * @return the taskData
	 */
	public T getTaskData() {
		return taskData;
	}
	/**
	 * @param taskData the taskData to set
	 */
	public void setTaskData(T taskData) {
		this.taskData = taskData;
	}
	
}
